''' 抠图 (color space) '''
import cv2 as cv
import numpy as np

img = cv.imread('../resources/miku.jpg')
hsv = cv.cvtColor(img, cv.COLOR_BGR2HSV)

mask1 = cv.inRange(hsv, (0, 43, 46), (10, 255, 255)) # type: ignore
mask2 = cv.inRange(hsv, (156, 43, 46), (180, 255, 255)) # type: ignore
mask = cv.bitwise_or(mask1, mask2)
cv.bitwise_not(mask, mask)
dst = cv.bitwise_and(img, img, mask=mask)

cv.imshow('output', dst)
cv.waitKey(0)
cv.destroyAllWindows()